package com.medi.chats.service.category;

import com.medi.chats.dao.McCategoriesMapper;
import com.medi.chats.model.McCategories;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

/**
 * 描述:
 * 分类服务
 *
 * @outhor Administrator
 * @create 2018-10-25 16:12
 */
@Service
public class CategoriesService {

    @Autowired
    McCategoriesMapper mcCategoriesMapper;


    /**
     * @Description  获取所有的分类
     * @Author        Administrator
     * @Date          2018/11/6 16:08
    */
    public List<McCategories> selectCategories() {
        return mcCategoriesMapper.selectCategories();
    }

    public List<McCategories> selectCategoriesWithAll() {
        List<McCategories> mcCatList = mcCategoriesMapper.selectCategories();
        McCategories catOfAll = new McCategories();
        catOfAll.setId(0L);
        catOfAll.setCatName("全部");
        mcCatList.add(0, catOfAll);
        return mcCatList;
    }
}
